import {useUserStore} from "@/store/index.js";
import {getRequest} from "@/util/request.js";
import router from "@/router/index.js";
import {Base64} from "js-base64";

export function getInfo() {
    let userStore = useUserStore();
    getRequest("/user/getInfo").then(res => {
        userStore.user = res.data;
        let path = router.currentRoute.value.query.path;
        if (path) {
            router.replace(Base64.decode(path)).then();
        } else {
            router.replace("/").then();
        }
    })
}